package com.lins.store.entity;

import lombok.Data;

import java.io.Serializable;
import java.util.Objects;

@Data
public class UserEntity extends BaseEntity implements Serializable {
   /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer uid ;
	//@NotNull(message = "用户名不能为空") spring框架的注解,但通过无参构造创建对象会因空而报错
	private String username;
	private String password ;
	private String salt ;
	private String phone ;
	private String email;
	private Integer gender; //性别
	private String avatar ; //头像
	private Integer state; //状态：0-正常，1-被删除，2-已经登录
	private String level; //权限
	private String createTime;

    public UserEntity() {
    }

    public UserEntity(String level) {
        this.level = level;
    }

    @Override
   public boolean equals(Object o) {
      if (this == o) return true;
      if (o == null || getClass() != o.getClass()) return false;
      if (!super.equals(o)) return false;
      UserEntity userEntity = (UserEntity) o;
      return Objects.equals(uid, userEntity.uid) && Objects.equals(username, userEntity.username) && Objects.equals(password, userEntity.password) && Objects.equals(salt, userEntity.salt) && Objects.equals(phone, userEntity.phone) && Objects.equals(email, userEntity.email) && Objects.equals(gender, userEntity.gender) && Objects.equals(avatar, userEntity.avatar) && Objects.equals(state, userEntity.state);
   }

   @Override
   public int hashCode() {
      return Objects.hash(super.hashCode(), uid, username, password, salt, phone, email, gender, avatar, state);
   }

   @Override
   public String toString() {
      return "UserEntity{" +
              "uid=" + uid +
              ", username='" + username + '\'' +
              ", password='" + password + '\'' +
              ", salt='" + salt + '\'' +
              ", phone='" + phone + '\'' +
              ", email='" + email + '\'' +
              ", gender=" + gender +
              ", avatar='" + avatar + '\'' +
              ", state=" + state +
              '}';
   }

}
